package com.ts.api.common.transaction.impl;

import com.ts.api.common.transaction.TransactionSupport;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.function.Supplier;

/**
 * @author caoxin
 */
@Service
public class TransactionSupportImpl implements TransactionSupport {

    @Transactional(propagation = Propagation.REQUIRES_NEW)
    @Override
    public <T> T requiresNew(Supplier<T> supplier) {
        return supplier.get();
    }

}
